package com.xuecheng.search.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.io.Serializable;
import java.util.Date;

/**
 * Created by admin on 2018/2/10.
 */
@Data
@Document(indexName = "xc_course",type = "docs",shards = 1,replicas = 0)
public class CourseSearch implements Serializable {
    private static final long serialVersionUID = -916357110051689487L;

    @Id
    private String id;

    @Field(type = FieldType.text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String name;

    @Field(type = FieldType.text,index = false)
    private String users;

    @Field(type = FieldType.keyword)
    private String mt;

    @Field(type = FieldType.keyword)
    private String st;

    @Field(type = FieldType.keyword)
    private String status;

    @Field(type = FieldType.keyword)
    private String grade;

    @Field(type = FieldType.keyword)
    private String studymodel;

    @Field(type = FieldType.keyword)
    private String teachmode;

    @Field(type = FieldType.text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String description;

    @Field(type = FieldType.keyword,index = false)
    private String pic;//图片

    @Field(type = FieldType.keyword)
    private String charge;

    @Field(type = FieldType.keyword)
    private String valid;

    @Field(type = FieldType.keyword,index = false)
    private String qq;

    @Field(type = FieldType.Float)
    private Float price;

    @Field(type = FieldType.Float)
    private Float price_old;

    @Field( type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")// 指定存储格式
    @JsonFormat(shape =JsonFormat.Shape.STRING,pattern ="yyyy-MM-dd HH:mm:ss",timezone ="GMT+8")// 数据格式转换，并加上8小时进行存储
    private Date expires_time;

    @Field(type = FieldType.text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String teachplan;//课程计划

    @Field( type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")// 指定存储格式
    @JsonFormat(shape =JsonFormat.Shape.STRING,pattern ="yyyy-MM-dd HH:mm:ss",timezone ="GMT+8")// 数据格式转换，并加上8小时进行存储
    private Date pub_time;//课程发布时间

    @Field( type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")// 指定存储格式
    @JsonFormat(shape =JsonFormat.Shape.STRING,pattern ="yyyy-MM-dd HH:mm:ss",timezone ="GMT+8")// 数据格式转换，并加上8小时进行存储
    private Date start_time;

    @Field( type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")// 指定存储格式
    @JsonFormat(shape =JsonFormat.Shape.STRING,pattern ="yyyy-MM-dd HH:mm:ss",timezone ="GMT+8")// 数据格式转换，并加上8小时进行存储
    private Date end_time;
}
